package com.kilomob.grady.handler.netty;

import io.netty.channel.ChannelPipeline;

import java.util.Map;

import com.kilomob.grady.codec.kryo.KryoCodec;
import com.kilomob.grady.codec.kryo.KryoDecoder;
import com.kilomob.grady.codec.kryo.KryoEncoder;
import com.kilomob.grady.codec.kryo.KryoPoolFactory;
import com.kilomob.grady.handler.NettyReceiveHandler;

public class KryoReceiveHandler implements NettyReceiveHandler {
    public void handle(Map<String, Object> handlerMap, ChannelPipeline pipeline) {
        KryoCodec util = new KryoCodec(KryoPoolFactory.getKryoPoolInstance());
        pipeline.addLast(new KryoEncoder(util));
        pipeline.addLast(new KryoDecoder(util));
        pipeline.addLast(new MessageReceiveHandler(handlerMap));
    }
}

